<template>
  <div id="app">
    <div v-if="user.isLogin">
    <van-nav-bar
      title="计算机在线学习系统"
      left-text="注销"
      right-text="测试记录"
      left-arrow
      @click-left="exit()"
      @click-right="goTo('/data')"
      style="cursor: pointer"
    />
    </div>
    <transition name="van-fade" mode="out-in">
      <router-view></router-view>
    </transition>
  </div>
</template>

<script>
  import {mapState} from 'vuex'
export default {
  name: 'App',
  data () {
    return {
      active: 0,
      path: ''
    }
  },
  computed:{
    ...mapState([
      'user'
    ])
  },
  mounted () {

  },
  methods:{
    exit(){
      this.$store.commit('set_userid',{id:'',isLogin:false});
    },
    goTo(path){
      this.$router.replace(path);
    }
  }
}
</script>

<style>
</style>
